#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>

/*char *makemessage(const char *fmt, ...)
{
	char *para;
	int n, size = 100;
	char *p, *np;
	va_list ap;

	va_start(ap, fmt);
	while (1) {
		para = va_arg(ap, char *);
		if (strcmp(para, "\0") == 0)
			break;
		printf("%s\n", para);

	}
	va_end(ap);
}

int main()
{
	char *p;
	p = makemessage("hah", "haha", "huhu", "\0");
	return 0;
}*/
char buffer[80];

int vspf(char *fmt, ...)
{
	va_list argptr;
	int cnt;

	va_start(argptr, fmt);
	//cnt = vsprintf(buffer, fmt, argptr);
	cnt = vsnprintf(buffer, sizeof(buffer), fmt, argptr);
	va_end(argptr);

	return(cnt);
}

int main(void)
{
	int inumber = 30;
	float fnumber = 90.0;
	char string[4] = "abc";

	//vspf("%d %f %s", inumber, fnumber, string);
	vspf("test\r\n", inumber, fnumber, string);
	printf("%s\n", buffer);
	return 0;
}
